<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
 
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
 
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div >
<c:set var="baseURL" value="${pageContext.request.contextPath}" scope="request"/>
  

	<table class="table " style="margin:2% 10% 0 10%；width：80%">
				<thead>
					<tr>
					    <th>
							代数
						</th>
						<th>
							会员等级
						</th>
						<th>
							规则（（1-2代）金豆，3代以后金币）
						</th>
						<th>
							会员等级奖励费
						</th>
						<th>
							奖励费单位
						</th>
						<th>
							当代人数
						</th>
						<th>
							修改
						</th>
					</tr>
				</thead>
				<tbody>
					<c:if test="${empty oneset}">
										<tr>
											<td>抱歉！无一代信息</td>
										</tr>
									</c:if>
									<c:if test="${!empty oneset}">
										<c:forEach items="${oneset}" var="one">
											<tr>
											    <td>${one.grade}</td>
												<td>${one.member_grade_name }</td>
												<td>${one.rule}</td>
												<td>${one.reward }</td>
												<td>${one.unit }</td>
												<td>${one.limit_person }</td>
												<td> <a  href="" data-target="#mymodal" role="button" class="btn btn-default" data-toggle="modal" onclick="onexiugai('${one.grade}','${one.member_grade_name}')">修改</a></td>
											</tr>
										</c:forEach>
									</c:if>
					
				</tbody>
			</table>
</div>
<div class="modal fade" id="mymodal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" tabindex="-1">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
							<h4 class="modal-title" id="myModalLabel">
								修改配置
							</h4>
						</div>
						<form role="form" action="xiushuju.do" method="post">
						<div class="modal-body">
						<input type="text" name="id" id="id"/>
						<input type="hidden" name="mg_id" id="mg_id"/>
						<div class="form-group">
					     <label for="rule">规则（（1-2代）金豆，3代以后金币）</label>
					     <input type="text" class="form-control" id="rule" name="rule" value=""/>
				      </div>
				      <div class="form-group">
					     <label for="reward">会员等级奖励费</label>
					     <input type="text" class="form-control" id="reward" name="reward" value=""/>
				      </div>
				      <div class="form-group">
					     <label for="unit">奖励费单位</label>
					     <!-- <input type="text" class="form-control" id="unit" name="unit" value=""/> -->
					     <select name="unit" class="form-control" id="unit"> 
                             <option value="金豆">金豆</option> 
                             <option value="地币">地币</option> 
                     </select> 
				      </div>
				      <div class="form-group">
					     <label for="limit_person">人数限制</label>
					     <input type="text" class="form-control" id="limit_person" name="limit_person" value=""/>
				      </div>
						</div>
						<div class="modal-footer">
							 <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> <button type="button" class="btn btn-primary">保存</button>
						</div>
						</form>
					</div>
					
				</div>
				
			</div>
			

<script type="text/javascript">
		function onexiugai(grade,member_grade_name){
			/* alert(member_grade_name); */
			 $.get("${baseURL}/findgmgn?grade="+grade+"&member_grade_name="+member_grade_name,
				function(result){//result返回的结果
				    $("#mg_id").val(result.mg_id);
				    $("#id").val(result.id);
					$("#rule").val(result.rule);
					$("#reward").val(result.reward);
					$("#unit").val(result.unit);
					$("#limit_person").val(result.limit_person);
				});
		}
	</script>
</body>
</html>